<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<title></title>
		<link rel="stylesheet" type="text/css" href="../commn/base.css" />
		<style type="text/css">
			.header {
				color: #0F88EB;
				font-size: 50px;
				font-weight: bold;
				height: 40px;
				line-height: 40px;
				text-align: center;
			}
			
			.bottom {
				height: 400px;
			}
			
			.xinxi {
				margin-top: 80px;
				-webkit-box-align: center;
			}
			
			.xinxi p:nth-child(2) {
				font-family: "微软雅黑";
				font-size: 14px;
				font-weight: bold;
			}
			
			.xinxi p:nth-child(3)>a {
				margin-left: 10px;
				-webkit-box-align: end;
				height: 40px;
				font-size: 14px;
				font-weight: bold;
				color: #0F88EB;
				line-height: 40px;
				text-decoration: none;
			}
			
			.bottom p {
				margin-top: 10px;
				height: 40px;
				line-height: 40px;
				text-align: center;
				/*border: 1px solid;*/
			}
			
			.phone,
			.passwora2,
			.password {
				width: 60%;
				height: 40px;
				text-indent: 1em;
				border: 1px solid #EEEEEE;
				-webkit-box-flex: 1;
				outline: none;
			}
			
			.bottom input[type=button] {
				height: 40px;
				width: 30%;
				color: white;
				font-size: 14px;
				border: 1px solid #0F88EB;
				background-color: #0F88EB;
				outline: none;
				border-radius: 40px;
			}
			
			.yanzheng {
				width: 30%;
				height: 40px;
				border: 1px solid #EEEEEE;
				/*-webkit-box-flex: 1;*/
				outline: none;
			}
			
			.choose {
				border-bottom: 2px solid #0F88EB;
			}
		</style>
	</head>

	<body>
		<div class="all">

			<div class="bottom">
				<from>
					<div class="xinxi">
						<p class="header">
							知乎
						</p>
						<p>与世界分享你的知识、经验和见解</p>
						<p>
							<a href="index.html" class="choose">登陆</a>
							<a href="../zhihu_reg/reg.html">注册</a>
						</p>
						<p><input type="text" placeholder="请输入用户名" class="phone" v-model="username" /></p>
						<p><input type="text" placeholder="请输入密码" class="password" v-model="password"/></p>
						<p><input type="button" name="" value="登录" @click="cc()" /></p>
					</div>
				</from>
			</div>
		</div>
		<script src="../js/jquery-2.1.4.js" type="text/javascript" charset="utf-8"></script>
		<script src="../js/vue.js" type="text/javascript" charset="utf-8"></script>
		<script type="text/javascript">
			var newVue = new Vue({
				el: "body",
				data: {
					username:"",
					password:""
				},
				methods: {
					cc:function(){
						login(this.username,this.password);
					}
				}
			});
			function login(username,password) {
						var ss;
						var dd;
						$.ajax({
							type: 'get',
							//async:false,
							url: "http://v2.mashupcloud.cn/developer/auth.do",
							data: {
								appkey: 'FvWrIYOQoTUYVbscUNQoQAVqsLnZqKEN',
								appsecret: 'ugCfcSmyLkcbCGfIuFOPEgTgPQPbyJSE'

							},
							success: function(json) {
								//		            console.log(json);
								ss = JSON.parse(json)[1];
								dd = JSON.parse(json)[2];
								console.log('获得token成功');
								$.ajax({
									type: 'get',
									url: "http://v2.mashupcloud.cn/SQL/sele_user_dl/",
									data: {
										appid: dd,
										token: ss,
										name: 'sele_user_dl',
										_v1: username,
										_v2: password

									},
									success: function(json) {
										json = JSON.parse(json);
										console.log(json);
										if(json[2].length > 0) {
											//							alert('成功');
											sessionStorage.setItem('id', json[2][0].id);
											sessionStorage.setItem('nicheng', json[2][0].nicheng);
											sessionStorage.setItem('email', json[2][0].email);
											location.href = '../zhihu_home/home.html';
										} else {
											alert('登录失败，不存在该用户');
										}

									},
									error: function(json) {
										console.log("err:" + json);
									}
								});
							},

							error: function(json) {

								console.log("err:" + json);

							}

						});
					}
		</script>
	</body>

</html>